package com.yinhe.music.yhmusic.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yinhe.music.common.GlideHelper.GlideHelper;
import com.yinhe.music.yhmusic.R;
import com.yinhe.music.yhmusic.model.RadioListInfo;

/**
 * Created by hasee on 2017/8/15.
 */

public class RecommendRadioAdapter extends BaseQuickAdapter<RadioListInfo, BaseViewHolder> {


    public RecommendRadioAdapter() {
        super(R.layout.recommend_menu_item);
    }

    @Override
    protected void convert(BaseViewHolder helper, RadioListInfo item) {
        helper.setText(R.id.song_menu_name, item.getRadioName());
        if (item.getPlayNum()<10000){
            helper.setText(R.id.song_menu_play_num, String.valueOf(item.getPlayNum()));
        } else {
            helper.setText(R.id.song_menu_play_num, item.getPlayNum()/10000 + "万");
        }

        helper.setGone(R.id.anchor,true)
                .setText(R.id.anchor,"主播：" + item.getNickname());

        ImageView image = helper.getView(R.id.song_menu_img);
        GlideHelper.setImageResource(image, item.getImage(), R.drawable.default_cover);
    }
}
